package com.yx.pay.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2018070560505426";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDb4ruU7aFOdHyZqx80fXZoxTflnAGGxRBW7dJRSK3C8wDrtXkPtRvtQa+zdmRe1/LFGscdFW6qx+JlebNd7woZqGk9QgZHXeEI8rZbRwVqfPgTltLuXDh6BK3C/dJ9zJW91i8WQ+sYCO+5yR4xtjIMQWizFHQwOhDhhCbsyPl5kAyW/G5Bvqmh3z9IU0z9gh6B15c8hK2aOpScDJaQXjmfJ6IQgO+Q7pTWznSRKdULbQf39UxEKIDapAhvzol917oKZ/mofavMINLq+kuI23xxj7KcPGrdBTo8CUtBolLWJtLRJs+oJcC1hP3nor0rvn0RQfQ7le5/CF9jS1YBhTPAgMBAAECggEAS56HNTwy7U24DIDp0Mo0xGczlmfRJKuppLhmLPWRPx5TbEFkBZLCBA8Zcw6XVpFUOXHHGBVzbmz0IPpdebcQmNlNRlSBM6aRLhHjVUnAiilecbYf4Sb5pI91XlpE7tu1IK1IKmiThfEVI7KwDAN0sdE2Cw3fwlRCCo5/Mp+YDkXiB1IWFeeGCqNlcqXA6UEbkhec9vW/RCVFVDnrj7nYOpXnecmGnC1oMOSaOzOQtf74DgHNw7mznPzeR/DSKF9WGZTB7uWu3lhYqYK31tdMwpSv7iYqtdlucPixe3teMj6wiYSVkDpuDpbw9Vawpowbai4IJwQabj3oxF3Dl/91AQKBgQDjIhUGrNAYf+bh3ToGxP1oC16j5osyrXztjo40JDpaQiR0pUdOoCCfywDf1s0Kd3tb8FY2Pbc3rRKp6kHPdUH0riaNmyWGY5Np4rWUnc0ezZb4/e3nYfRABpbIX1IqahAiqFzdqTbYZ2w2kkvVWWI9QtY8xmfNaYdKuofPMPYBQQKBgQDcRipQThS4k4W7JZr1RrXeCuyo84R5AH8vIFL7tgDmv9KkC2QuObzkzTx1KUMeDDWA+0j42FbbmeB/dQ+Y/v5mcRBXfhFt7sizjGx0FhHoEXP/SK9KNhMFIuNIIFZTJyzIGwJm2w0qo1vRCUGbm8bU5igfKncE47mjosAnZbmCDwKBgQC3LkqU2pTt3WFgsaHVydOxsNHAD/QdiAukL3+Cj+E73/I03QNYZw5IsVlgLYWqNliX+oodLsLwNTZDMTmoTiJGapmPRRwLeY1vLTdSx72hZR+oamsPXFG3vVin+zByIp4mxXA4GPuxph+BF5XvWCpBzACqfT1ETiKd4zgaopsUwQKBgDyXBE6gm6yFz7RBzNUJBT+1i5GRom/SRinFX24jiy3tt9gt1fmtIhthpO6pUe/y9cir1k+02nd/ZTRKE+dGxN2S3ibi45J0qzpQNwjbhUNrgZfH+4eTRjoUdaZCVtx6myPT4h4+xOlkk/306NoPyGqJgKHKAYETzt2HCAoOPi/bAoGBALubZI+R7gJl7GkI9b0TKDDLzOni8irImFnViZoS+Db/T3rNcDms5M6+O+OOa2iYrllvwGs5KRAdLwZ7sZGXXEYoVXlXI2fj07Xw6Una7tV1HKHTxymcWM1KdM6A74FAsx4fX+xdXQYeSy1EiVUVhuKI5DyyBHU3pYlD/MLC9XrR";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ZGiJ7DWDX6ILCA+0LtKPzwO3kXcJOPPhV0+RwdVI+GbqTbB1E30lscKsN3S7i+9fYxKX28vj0P0mDNM+yu+OlJElgbTowaD/ejzqISzyerK19pCXC1AW6qLKr2RzE5Fyl1lzE9ECx0Jux+fVXffXN1IIxc27gWo0F9TA0vDOVeMcSmZjfqeoCyFCvXPfU0Q3wsVa368mDzq5VJIeG56yZgX0Cr58E60LpnweLms2WwhTB8cVTiRbE1fRDsU1NT2BZWZWp3CIQ1wicR27LeFGyKkwkPiBPNMHGvkM6H8N5MwXCHhprFVz5A6EeyxHONIgOfKFcOVPGfEf3TW3o2N1wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://www.youwenyuedu.com:8082/youxiang/pc/api/user/notify_url";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://www.youwenyuedu.com/#/PaySuccess";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

